package shopping;

public class Goods {
	private int num; // 商品编号
	private String name; // 商品名
	private int price; // 价格
	private int amount = 1;// 数量
	private String picture; // 图片

	public void setNum(int num) {
		this.num = num;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setPrice(int price) {
		this.price = price;
	}

	public void setAmount(int amount) {
		this.amount = 1;
	}

	public void setPicture(String picture) {
		this.picture = picture;
	}// set方法

	public int getNum() {
		return num;
	}

	public String getName() {
		return name;
	}

	public int getPrice() {
		return price;
	}

	public int getAmount() {
		return amount;
	}

	public String getPicture() {
		return picture;
	}// get方法

	public void addAmount() {
		this.amount++;
	}

	public void reduceAmount() {
		this.amount--;
	}

	public Goods(int num, String name, int price, int amount, String picture) {
		this.num = num;
		this.name = name;
		this.price = price;
		this.amount = amount;
		this.picture = picture;
	}

	public Goods() {

	}// 构造函数

	@Override
	public String toString() {
		return "商品编码" + this.getNum() + ",商品名" + this.getName() + ",价格"
				+ this.getPrice() + ",数量" + this.getAmount();
	}

}